<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    626. Exchange Seats
   </h1>
   <p>
    Mary is a teacher in a middle school and she has a table
    <code>
     seat
    </code>
    storing students' names and their corresponding seat ids.
   </p>
   The column
   <b>
    id
   </b>
   is continuous increment.
   <p>
    &nbsp;
   </p>
   Mary wants to change seats for the adjacent students.
   <p>
    &nbsp;
   </p>
   Can you write a SQL query to output the result for Mary?
   <p>
    &nbsp;
   </p>
   <pre>
+---------+---------+
|    id   | student |
+---------+---------+
|    1    | Abbot   |
|    2    | Doris   |
|    3    | Emerson |
|    4    | Green   |
|    5    | Jeames  |
+---------+---------+
</pre>
   For the sample input, the output is:
   <p>
    &nbsp;
   </p>
   <pre>
+---------+---------+
|    id   | student |
+---------+---------+
|    1    | Doris   |
|    2    | Abbot   |
|    3    | Green   |
|    4    | Emerson |
|    5    | Jeames  |
+---------+---------+
</pre>
   <p>
    <b>
     Note:
    </b>
    <br>
    If the number of students is odd, there is no need to change the last one's seat.
   </p>
  </div>
  <div>
   <h1 class="question_title">
    626. 换座位
   </h1>
   <p>
    小美是一所中学的信息科技老师，她有一张
    <code>
     seat
    </code>
    &nbsp;座位表，平时用来储存学生名字和与他们相对应的座位 id。
   </p>
   <p>
    其中纵列的&nbsp;
    <strong>
     id&nbsp;
    </strong>
    是连续递增的
   </p>
   <p>
    小美想改变相邻俩学生的座位。
   </p>
   <p>
    你能不能帮她写一个 SQL query&nbsp;来输出小美想要的结果呢？
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     示例：
    </strong>
   </p>
   <pre>
+---------+---------+
|    id   | student |
+---------+---------+
|    1    | Abbot   |
|    2    | Doris   |
|    3    | Emerson |
|    4    | Green   |
|    5    | Jeames  |
+---------+---------+
</pre>
   <p>
    假如数据输入的是上表，则输出结果如下：
   </p>
   <pre>
+---------+---------+
|    id   | student |
+---------+---------+
|    1    | Doris   |
|    2    | Abbot   |
|    3    | Green   |
|    4    | Emerson |
|    5    | Jeames  |
+---------+---------+</pre>
   <p>
    <strong>
     注意：
    </strong>
   </p>
   <p>
    如果学生人数是奇数，则不需要改变最后一个同学的座位。
   </p>
  </div>
 </body>
</html>